package com.aqielife.demo.security.service;

/**
 * @author aqie
 * @date 2022/02/13 20:09
 * @desc
 */

import com.aqielife.demo.security.entity.User;
import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

/**
 * 登录校验
 */
@Service
public class UserService implements ReactiveUserDetailsService {


  @Override
  public Mono<UserDetails> findByUsername(String username) {
    // 根据用户名从数据库 查询 user

    // 初始化登录认证对象
    User user = new User();
    // 拷贝属性

    return Mono.create(userSink -> userSink.success(user));
  }
}
